<extend name="./Application/Admin/View/common/base.html" />
<block name="crumb">
    <span class="c-gray en">&gt;</span> 代理管理
    <span class="c-gray en">&gt;</span> 默认地址
</block>
<block name="content">

</block>

<!--自己的css和js-->
<block name="css">
    <link href="__PUBLIC__/Admin/static/ext/css/zoomify.css" rel="stylesheet" type="text/css" />
</block>
<block name="js">
    <script type="text/javascript" src="__PUBLIC__/Admin/static/ext/js/zoomify.js"></script>
    <script type="text/javascript">
        $('.large_img').zoomify();
        $(function () {
            $('.del_brand').click(function () {
                var _this = $(this);
                layer.confirm('您确认删除此品牌吗？', {
                    btn: ['确认','取消']
                }, function(){
                    $.ajax({
                        url: "{:U('Brand/del')}",
                        type: "post",
                        data: {
                          id: _this.attr('iid')
                        },
                        beforeSend: function () {
                            //layer.msg('删除品牌中..', {icon: 16,time:500});
                        },
                        success: function (msg) {
                            //alert(msg);
                            if (msg == -1) {
                                layer.msg('此品牌有商品占用，请先删除!', {icon: 8,time:1000});
                            } else if(msg == 1) {
                                window.location.href = "{:U('Brand/index')}";
                            } else {
                                layer.msg('修改失败!', {icon: 2,time:1000});
                            }
                            //msg==1 ? window.location.href = "{:U('Brand/index')}" : layer.msg('修改失败!', {icon: 2,time:1000});
                        }
                    });
                });
            });
        });
        $('.large_img').zoomify();

        function doEdit($brand_id ,$val)
        {
            $.ajax({
                url: "{:U('Brand/edit_brand')}",
                type: "post",
                data: {
                    id: $brand_id, val: $val,
                },
                beforeSend: function () {
                    //layer.msg('删除品牌中..', {icon: 16,time:500});
                },
                success: function (msg) {
                    //alert(msg);
                    if (msg) {
                        if (msg.status == "success") {
                            location.reload(true);
                        }else{
                            layer.alert(msg.msg);
                        }
                    }else{
                        layer.alert('修改失败!');
                    }
                }
            });
        }
    </script>
</block>



